package com.mediocre.controller;

import com.mediocre.dto.PostHaloDTO;
import com.mediocre.dto.PostQueryDTO;
import com.mediocre.entity.Post;
import com.mediocre.entity.PostHalo;
import com.mediocre.service.ICommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "1 通用管理")
@RestController
@RequestMapping("/api")
@Slf4j
public class CommonController {

    @Autowired
    private ICommonService commonService;

    /**
     * to keep heartbeats with server
     * @return String
     */
    @ApiOperation("向博客园定期发送心跳")
    @GetMapping("/msg")
    public String msg() {
        log.info("method msg start");
        String msg = commonService.msg();
        log.info("method msg end");
        return msg;
    }

    @GetMapping("/addToModels1")
    public void addToModels(@RequestBody Post post) {}

    @GetMapping("/addToModels2")
    public void addToModels(@RequestBody PostHalo postHalo) {}

    @GetMapping("/addToModels3")
    public void addToModels(@RequestBody PostQueryDTO postQueryDTO) {}

    @GetMapping("/addToModels4")
    public void addToModels(@RequestBody PostHaloDTO postHaloDTO) {}

}
